package lolnotepad;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
 *
 * @author havlicekdom@gmail.com
 */
public class backButton {
    public JButton create(final JFrame frame, final JPanel panel){
        JButton button = new JButton("Close");
        button.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                        panel.removeAll();
                        frame.remove(panel);
                        frame.setVisible(false);
                        frame.dispose();
                        new LoLNotepad().build();
                        frame.setCursor(Cursor.getDefaultCursor());
                    }
                });
        return button;
    }
}
